const mongoose = require("mongoose");

// 获取收货地址信息
module.exports.getAdresses_3 = async function({pageSize, currentPage}){
    let totalCount = await mongoose.model("addressesModel").find().countDocuments();
    let totalPage = Math.ceil(totalCount / pageSize);
    let goods = await mongoose.model("addressesModel").find().limit(pageSize - 0).skip((currentPage - 1) * pageSize); //. populate("usersId")
    return { totalCount, pageSize, currentPage, totalPage, goods };
}

// 通过ID修改收货地址
module.exports.modifyAddress_3 = async function({_id, address}){
    let result = await mongoose.model("addressesModel").updateOne({_id}, {address});
    return result;
}

// 5def655864f7ae3d34a8763a
// 5def655864f7ae3d34a8763a